<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateServiceCityTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('service_city', function (Blueprint $table) {
            $table->integerIncrements('id');
            $table->smallInteger('province_id')->default(0)->comment('省份ID');
            $table->string('province_name')->default('')->comment('省份名称');
            $table->smallInteger('city_id')->default(0)->comment('城市ID');
            $table->string('city_name')->default('')->comment('城市名称');
            $table->integer('default_user_company_id')->nullable()->default(0)->comment('用户默认公司ID');
            $table->integer('default_driver_company_id')->nullable()->default(0)->comment('司机默认公司ID');
            $table->tinyInteger('status')->default(1)->comment('状态 1-正常 0-禁用');

            $table->unique('city_id');

            $table->softDeletes();
            $table->timestamps();
        });
        \DB::statement("ALTER TABLE `service_city` comment '开放城市'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('service_city');
    }
}
